# -*- coding: utf-8 -*-
from odoo import http


class BugManage(http.Controller):
    # @http.route('/bm/bug_manage/', auth='public')
    # def index(self, **kw):
    #     return "Hello, world"
    #
    # @http.route('/bm/bug_manage/objects/', auth='public')
    # def list(self, **kw):
    #     return http.request.render('bug_manage.listing', {
    #         'root': '/bm/bug_manage',
    #         'objects': http.request.env['bm.bug'].search([]),
    #     })
    #
    # @http.route('/bm/bug_manage/objects/<model("bm.bug"):obj>/', auth='public')
    # def object(self, obj, **kw):
    #     return http.request.render('bug_manage.object', {
    #         'object': obj
    #     })
    @http.route('/bug_manage')
    def bug_manage(self, **kwargs):
        bugs = http.request.env['bm.bug']
        domain_bug = [('is_closed', '=', False)]
        bugs_open = bugs.search(domain_bug)
        return http.request.render('bug_manage.bugs_template', {'bugs_open': bugs_open})
